{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Logistic Regression\n",
    "\n",
    "\n",
    "We'll be trying to predict a classification- survival or deceased.\n",
    "\n",
    "We'll use a \"semi-cleaned\" version of the titanic data set, if you use the data set hosted directly on Kaggle, you may need to do some additional cleaning not shown in this lecture notebook.\n",
    "\n",
    "## Import Libraries\n",
    "Let's import some libraries to get started!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The Data\n",
    "\n",
    "Let's start by reading in the titanic_train.csv file into a pandas dataframe."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "train = pd.read_csv('titanic_train.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "\n",
       "                                                Name     Sex   Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male  22.0      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                             Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "4                           Allen, Mr. William Henry    male  35.0      0   \n",
       "\n",
       "   Parch            Ticket     Fare Cabin Embarked  \n",
       "0      0         A/5 21171   7.2500   NaN        S  \n",
       "1      0          PC 17599  71.2833   C85        C  \n",
       "2      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "3      0            113803  53.1000  C123        S  \n",
       "4      0            373450   8.0500   NaN        S  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Exploratory Data Analysis\n",
    "\n",
    "Let's begin some exploratory data analysis! We'll start by checking out missing data!\n",
    "\n",
    "## Missing Data\n",
    "\n",
    "We can use seaborn to create a simple heatmap to see where we are missing data!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19eff7dd3d0>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data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Ofp7u/wWom3WMo3w7nZuaNEfFYYFnF40tSSznDn6e7v8GqTaRJ0qZs7NJc45flYri/dWZWaYGt2b2wI3AspY679ehxNxWXpNVqlhdOA74J7AG8j7IBzfKKx5ekTV7Nke5Vmfn0iLg+M/cZHnNTcUkaU3MZ8GgRxO0R8TLgNuAxFY8vSZu8mkn3AxHxcOD3gY8CS4Dfq3h8Sdrkzbu8EBFbA28GHk/ZCu3kYQcwSdIUNZLumZTSwqXAocB3M/OYCv82Sdrs1Ei6N2TmU4c/bwFckZn71/jHSdLmpkbL2KpdxCwrSNK61RjpjlZxwJorOYKyB+WSeQWQpM2Iy4AlqaOaK9IkSeth0pWkjky6ktSRSVeSOjLpSlJH/w74+5xQuJu1xAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(train.isnull(),yticklabels=False,cbar=False,cmap='viridis')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Roughly 20 percent of the Age data is missing. The proportion of Age missing is likely small enough for reasonable replacement with some form of imputation. Looking at the Cabin column, it looks like we are just missing too much of that data to do something useful with at a basic level. We'll probably drop this later, or change it to another feature like \"Cabin Known: 1 or 0\"\n",
    "\n",
    "Let's continue on by visualizing some more of the data!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8effcdf0>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEECAYAAAAlEzNMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA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kSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.set_style('whitegrid')\n",
    "sns.countplot(x='Survived',data=train,palette='RdBu_r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f0705e0>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEECAYAAAAlEzNMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAXaklEQVR4nO3df0xV9/3H8de5IBfkhwat7fwiDlAqxhA1RmycbCxV3BZtZxQtBmfaauriOuic2KKAmwrEjpi6qNXasNIqw58zXU1Wf6wmurKJ8cf0ihUdG2o7ytzkMrkgnO8frkxXpSj3cpHP8/GXl3vv8X1vuPfJOffez7Vs27YFADCWw98DAAD8ixAAgOEIAQAYjhAAgOEIAQAYLtDfAzyokydPyul0+nsMAHikeDwejR49+p7nPXIhcDqdSkhI8PcYAPBIcblc9z2PQ0MAYDhCAACGIwQAYLhH7jUCALiflpYW1dbWqqmpyd+j+E1wcLCioqLUp0+fTl+HEADoNWpraxUeHq6vf/3rsizL3+N0O9u2VV9fr9raWsXExHT6ehwaAtBrNDU1acCAAUZGQJIsy9KAAQMeeI+IEADoVUyNwBce5vYTAgAwHK8RAMAD2rx5s44dOyaHwyHLspSVlaVRo0b5e6yHZmQIWtvaFOBgZ0jivgAe1MWLF3Xo0CFt375dlmXJ5XIpOztb+/bt8/doD83IEAQ4HNp7otrfY/QIz46N8/cIwCMlMjJSV69e1c6dO5WcnKy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LlTn332mRISErRz505lZGSourpakrR9+3atX79etbW1mjZtmjIyMrRlyxZ95zvf0Rcfw1m5cqU+/PDD9uvNmDFDtbW1kqT9+/dr1apVamho0Msvv6yMjAxlZGSoqqpKkvTee+/p2Wef1YIFC1gSHH5BCGC0yMhIbdy4USdOnNDs2bM1depUHT58+L6Xr6ur09atW7VgwQI9+eSTOn78uJqbm/XHP/5RKSkp7ZebOXOm9u7dK0nas2eP0tLStGnTJk2YMEGlpaX6+c9/rvz8fDU0NOidd95ReXm5NmzYoJaWFp/fZuB/cWgIRqupqVFYWJgKCgokSWfOnNHChQs1cODA9svc+eH7qKgoBQUFSZLS0tK0Z88e1dXV6dvf/vZdC/dNnz5dzz33nGbNmiW32634+HhduHBBH3/8sfbv3y9JunHjhi5duqRhw4a1bzMxMdHntxn4X+wRwGhVVVXKz8+Xx+ORJMXExCg8PFz9+/dXXV2dJOncuXPtl3c4/vuQeeqpp+RyubRr1y7NnDnzru2GhYVp1KhRKigo0IwZMyRJsbGxmj9/vkpLS7Vu3TpNmzZNQ4YM0cWLF9XU1KTW1la5XC5f32TgS9gjgNGmTJmi6upqzZo1S3379pVt21q6dKn69Omjn/3sZ/ra176mQYMG3fO6lmUpNTVVx44d09ChQ790/qxZs/Tiiy+2L+r30ksvKScnR+Xl5XK73Vq8eLEiIyP14x//WHPmzFFkZCTfygW/YNE5ADAch4YAwHCEAAAMRwgAwHCEAAAMRwgAwHCEAAAMRwgAwHD/DzBy8i+e+49kAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.set_style('whitegrid')\n",
    "sns.countplot(x='Survived',hue='Sex',data=train,palette='RdBu_r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f0771c0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEECAYAAAAlEzNMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAa+UlEQVR4nO3df2zU9eHH8ef1xx21LWCtME1tBbRSJV1rGqppYOIXaOfSoYQecOQcFF1oMNhm8sMCBVa0kGIdEgtKXDaL2nX8Gm7TBSuTRKTLqtCBV50VyQqMFIKhd5NPf3DfP5w3EFqu7f2gfF6Pv7i7z737uvrxXn1/flq8Xq8XERExrYhwBxARkfBSEYiImJyKQETE5FQEIiImpyIQETG5qHAH6KtDhw5hs9nCHUNEZFAxDIOMjIyrvjboisBms5GWlhbuGCIig4rL5erxNW0aEhExORWBiIjJqQhERExu0O0jEBEJl87OTlpbW7lw4UK4o/RoyJAhJCUlER0d7fd7VAQiIn5qbW0lPj6eO++8E4vFEu44V/B6vZw9e5bW1lZGjRrl9/u0aUhExE8XLlzglltuuS5LAMBisXDLLbf0ecaiIhAR6YPrtQS+0598KgIREZNTEYiIBEBDQwMPPvggTqcTp9OJ3W6npqbmqss6nU5aWlpCnLBn2lksQeHt7sQS6f9RC9eDwZhZri8PPPAAL774IgAdHR3k5eUxbdo0hg4dGuZkvVMRSFBYIqM58/bicMfok8T8ynBHkBuI2+0mIiKC5uZmNmzYgNfrZeTIkWzYsMG3zL///W9Wr16NYRh8/fXXLFy4kMmTJ/Piiy9y8OBBLl68yE9+8hPmzp3LG2+8we7du4mIiOD+++9n6dKlAcuqIhARCZCDBw/idDqxWCxER0ezcuVK1q5dy4svvsiYMWN44403Ltsk9OWXXzJv3jyys7P5+OOP2bRpE5MnT2b37t1s27aNkSNHsnPnTgB27tzJypUrycjI4M0336Srq4uoqMB8hasIREQC5NJNQ98pLS1lzJgxAMyZM+ey12699VY2b97M9u3bsVgsdHV1AVBVVUVVVRVnzpxhwoQJAFRUVPDrX/+aDRs2kJGRQSBvN6+dxSIiQTRixAi++uorAF599VX27t3re23jxo1MmzaNyspKsrOz8Xq9dHR08O6771JVVcVvf/tbdu3axYkTJ6irq2PNmjVs27YNl8vFJ598ErCMmhGIiATRmjVrKC0tJSIigltvvZW5c+fy+uuvA5CXl8dzzz3HK6+8wm233ca5c+ewWq0MGzaMadOmMWzYMHJycrj99tu55557mDFjBjfffDMjR47khz/8YcAyWryBnF+EgMvl0v0IBgntLJYbzWD5/rlazt6ya9OQiIjJqQhEREwuKPsIuru7WbFiBceOHSMyMpKKigra29tZsGABd955JwCzZ8/mkUceoa6ujtraWqKioigqKmLSpEnBiCQiIj0IShHs27cPgNraWhoaGqioqODhhx9m3rx5FBYW+pZra2ujpqaGHTt2YBgGDoeDnJwcrFZrMGKJiMhVBKUIJk+ezEMPPQTAyZMnSUxM5MiRIxw7doz6+npSUlIoLS2lqamJzMxMrFYrVquV5ORkmpubSU9PD0YsERG5iqAdPhoVFcXSpUvZu3cvL730EqdPn6agoIBx48axefNmXn75ZcaOHUt8fLzvPbGxsbjd7l7HNQwDl8sVrNgSIIPhyIqr0bolvens7OSbb77xPbZEWxkSFRmw8S90dePt7BjwOJ2dnX1al4N6HsH69et55plnsNvt1NbWMnLkSACmTJlCeXk5WVlZeDwe3/Iej+eyYrgam802aL9k5PqndUt643K5iImJuey5lDcDd2LXcUcmRMVcc7nDhw+zYcOGHq9uGh0dfdXDR3sSlKOGdu/ezSuvvAJATEwMFouFp556iqamJgA++ugj7rvvPtLT02lsbMQwDNrb22lpaSE1NTUYkUREbghbt25lxYoVGIYRsDGDMiOYOnUqzz77LHPmzKGrq4vS0lJuu+02ysvLiY6OJjExkfLycuLi4nA6nTgcDrxeLyUlJdhstmBEEhG5ISQnJ7Np0yaWLFkSsDGDUgQ33XQTGzduvOL52traK56z2+3Y7fZgxBARueHk5ubS2toa0DF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WsXr2a9vZ2Xn/9derq6qiurqazszPon1nk+7RpSEzt+PHjxMXFUVFRAcA//vEPfv7zn5OYmOhb5tKT75OSkrBarQDY7XZ27dpFW1sbDz/88GUX7vvpT3/K7NmzKSgowO12k5qayueff87Bgwd55513ADh//jxffvkld911l2/M9PT0oH9mke/TjEBM7bPPPmP16tUYhgHAqFGjiI+PZ/jw4bS1tQHw6aef+paPiPjf/zIPPvggLpeLHTt2MGPGjMvGjYuLY9y4cVRUVDB9+nQARo8ezdy5c6mpqeFXv/oV+fn53HHHHXzxxRdcuHCB7u5uXC5XsD+yyBU0IxBTmzp1Ki0tLRQUFHDTTTfh9XpZsmQJ0dHR/PKXv+S2225jxIgRV32vxWIhNzeXAwcOkJKScsXrBQUFPPHEE76L+i1YsIDly5dTV1eH2+3mqaeeIiEhgaeffppZs2aRkJCgu3JJWOiicyIiJqdNQyIiJqciEBExORWBiIjJqQhERExORSAiYnIqAhERk1MRiIiY3P8D37z98aFABXoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.set_style('whitegrid')\n",
    "sns.countplot(x='Survived',hue='Pclass',data=train,palette='rainbow')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f13e8e0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAEECAYAAADnD7WNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAZuUlEQVR4nO3df0xV9+H/8ddB6kWoiJWsNTF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ffee08+n08rVqxQbm6uI3IdOnRIb775pqQvPwvtdrtVXV2tnTt3jvrPZXFxsS5cuKCEhARt3749du8x24EOHz5sFxUV2bZt25988oldUFAwqnkOHjxoP/TQQ/by5ctt27btp59+2j5x4oRt27ZdWlpq/+1vf4t7ptdff93esWOHbdu2ffnyZXvRokWOyGXbtn3kyBG7uLjYtm3bPnHihF1QUOCYbFeuXLF/9KMf2UuXLrXPnDnjiFw9PT32d77znSGPOSHXiRMn7Kefftq+evWq3dHRYe/bt88RuYbbtm2b/corrzgi25EjR+wNGzbYtm3bH3zwgf3MM8/ELJcjT5s4bfr9zJkztX///oHl+vp65ebmSpLy8vJ0/PjxuGe6//779eyzzw4sT5gwwRG5JOm+++7T9u3bJUmNjY1KT093TLby8nI98cQT+trXvibJGa/lZ599pu7ubq1Zs0arV6/WqVOnHJHrgw8+0G233ab169eroKBAixcvdkSuwT799FOdOXNGjz/+uCOyZWZm6urVq+rr61NHR4cSExNjlsuRp006Ojp04403DixPmDBBvb29AWdxxlJ+fr7Onz8/sGzbtizLkiSlpKSovb097plSUlIkffm92rBhgwoLC1VeXj7qufolJiaqqKhIR44c0b59+3Ts2LFRz3bo0CHddNNNWrhwoQ4ePCjJGa9lUlKSnnrqKS1fvlznzp3T2rVrHZGrpaVFjY2NOnDggM6fP69169Y5ItdgFRUVWr9+vSRnvJbJycm6cOGCHnjgAbW0tOjAgQM6efJkTHI5srzDnX4fb4PPV3V2dio1NXVUcng8Hq1fv14rV67Uww8/rD179jgiV7/y8nJt3LhRjz32mLxe78Djo5XtjTfekGVZ+uijj+R2u1VUVKTLly+Peq7MzExlZGTIsixlZmYqLS1N9fX1o54rLS1NWVlZmjhxorKysuRyudTU1DTqufq1tbXpiy++0IKv7g3rhJ/Ll156Sffee69++tOfyuPx6Ac/+IF8Pl9McjnytInTp9/PmTNHdXV1kqTa2lrNmzcv7hmam5u1Zs0abdq0ScuWLXNMLkl66623VFFRIUmaNGmSLMvSHXfcMerZXn75ZVVVVamyslI5OTkqLy9XXl7eqOd6/fXXtXv3bknSxYsX1dHRoXvuuWfUc9155516//33Zdu2Ll68qO7ubt11112jnqvfyZMndffddw8sO+H9n5qaOvCH5ylTpqi3tzdmuRw5w9KJ0+/Pnz+vn/zkJ3r11Vd19uxZlZaWyufzKSsrSzt27NCECRPimmfHjh3661//qqysrIHHnn/+ee3YsWNUc0lSV1eXNm/erObmZvX29mrt2rWaNWvWqH/PBlu1apW2bdumhISEUc915coVbd68WY2NjbIsSxs3btTUqVNHPZckvfDCC6qrq5Nt2/rxj3+sGTNmOCKXJL344otKTEzUk08+KUmO+Lns7OzUli1b9N///lc+n0+rV6/WHXfcEZNcjixvAEBgjjxtAgAIjPIGAANR3gBgIMobAAxEeQOAgShvjBsHDx7UvffeO2TCEGAqyhvjxp///Gc9+OCD+stf/jLaUYDr5pw550AM1dXVaebMmXriiSe0adMmPfroo/r73/+un/3sZ0pJSdG0adPkcrm0e/duVVZW6p133pFlWXrwwQe1evXq0Y4PXIMjb4wLr732mpYvXz5wrY7Tp0+rrKxMu3fv1h/+8AfNnDlTknTmzBm9++67qq6uVnV1tY4ePaovvvhilNMD1+LIG2Nea2uramtrdfnyZVVWVqqjo0NVVVX6z3/+o+zsbElfXsfj3Xff1eeff67GxsaBKdetra3697//PeQyBIATUN4Y895++21973vfU1FRkSSpu7tb3/72t5WUlKQzZ85o9uzZOn36tCQpKytLs2fP1osvvijLsvTSSy857sJogER5Yxx47bXX9MILLwwsT5o0SUuXLlV6erq2bNmi5ORk3XDDDbr55pt1++2366677tKKFSt05coVfeMb39DNN988iumBkXFhKoxbL7/8sh544AHddNNN+uUvf6kbbrhBzzzzzGjHAkLCkTfGrWnTpmnNmjVKTk7W5MmTB66pDZiAI28AMBAfFQQAA1HeAGAgyhsADER5A4CBKG8AMND/B7Ulp8No8ttSAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.distplot(train['Age'].dropna(),kde=False,color='darkred',bins=30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f1efaf0>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAD3CAYAAADSftWOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAXx0lEQVR4nO3db0xV9+HH8c+5gIBQZp3ZI1IDgtl1PjArQdtOdFmRLlmzttFaXXSLnSmOxtLNFrQgJhqVuvnLNNvALssSKOsaa5s9WTakJlStxCy16cjtlq7WhOufzGLivfRyuXDP70ELA+T+9d7L+eL79chz7vec87l//HA5nD+Wbdu2AABGcc12AABA4ihvADAQ5Q0ABqK8AcBAlDcAGCg7Exu5dOmScnNzE14uGAwmtVy6OTWX5Nxs5EqMU3NJzs02F3MFg0GtWLFixscyUt65ublyu90JL+fxeJJaLt2cmktybjZyJcapuSTnZpuLuTweT8TH2G0CAAaivAHAQJQ3ABiI8gYAA1HeAGAgyhsADER5A4CBKG8AMBDlDQAGysgZlph9gcFBjQYCMcdl5+crf+HCDCQCcDco73vEaCCg7tramOOq29oykAbA3WK3CQAYiPIGAANR3gBgIMobAAwU8w+Wp06d0ttvvy3pywuDezwedXV16eDBg7IsS+Xl5WppaZHLxc8BAMiUmI371FNPqaOjQx0dHfrWt76lpqYm/eY3v1F9fb26urpk27Z6enoykRUA8BXLtm07noEfffSRXn31VXV0dGj16tXq7e2VZVk6ffq0zp07p5aWlojLJnsbtOHhYeXl5SW8XLo5NZcUOduinBz9dfv2mMt//7XXdDMUyliu2UauxDk121zNFekuP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c54L/Py8vTss89qw4YN+uyzz7R9+3ZH5Lp165auXr2qtrY2DQwMaMeOHY7INVl7e7vq6uokOeO9nD9/vrxer77//e/r1q1bamtr08WLF9OSy5Hlnejp95k2eX/V0NCQioqKZiXHtWvXVFdXp82bN+vxxx/XkSNHHJFrXGtrq3bt2qWnn35awWBwYv5sZXvrrbdkWZbef/99eTweNTQ0aHBwcNZzlZSUaPHixbIsSyUlJVqwYIH6+/tnPdeCBQtUWlqqefPmqbS0VLm5ubp+/fqs5xp3+/Ztffrpp1q1apUkZ/y//OMf/6jvfOc7+sUvfqFr167pxz/+sUKhUFpyOXK3idNPv1+2bJn6+vokSb29vaqoqMh4hps3b2rbtm166aWXtH79esfkkqR33nlH7e3tkqT8/HxZlqXly5fPerbXX39dnZ2d6ujokNvtVmtrq6qqqmY918mTJ3X48GFJ0o0bN+T3+/XII4/Meq4HH3xQ7733nmzb1o0bNxQIBPTQQw/Neq5xFy9e1MMPPzwx7YTPf1FR0cQfnr/2ta9pdHQ0bbkceYalE0+/HxgY0M9//nO9+eabunz5spqbmxUKhVRaWqoDBw4oKysro3kOHDigv/71ryotLZ2Y98orr+jAgQOzmkuSvvjiC+3evVs3b97U6Oiotm/friVLlsz6azbZli1btG/fPrlcrlnPNTIyot27d+vq1auyLEu7du3S/fffP+u5JOnVV19VX1+fbNvWiy++qOLiYkfkkqTf//73ys7O1k9+8hNJcsT/y6GhIe3Zs0f//e9/FQqFtHXrVi1fvjwtuRxZ3gCA6By52wQAEB3lDQAGorwBwECUNwAYiPIGAANR3gBgIMobAAz0/3oO/Mb1nEIkAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "train['Age'].hist(bins=30,color='darkred',alpha=0.7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f0d21f0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEECAYAAAAlEzNMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAX0klEQVR4nO3dbXBU9d3/8c/ZxF1gk4AReYAYJgEyDdNmgsaklhLMv5bQznhbCGG5FhRrK4OXTVq5VRJqlZBhmqF6DSKO1hKQmBKqXJ1pGQmUtKHNdNICNd2ATZUWoQwgHXdXZnN3rgdq/gSSkNjsnoTf+/Uoe3azfI/gvvec3f2tZdu2LQCAsVxODwAAcBYhAADDEQIAMBwhAADDEQIAMFy80wMM1pEjR+TxeJweAwBGlEgkoqysrF6vG3Eh8Hg8ysjIcHoMABhRAoFAn9dxaggADEcIAMBwhAAADEcIAMBwhAAADEcIAMBwhAAADEcIAMBwhAAADBe1Txa/9NJLOnDggNrb27Vw4ULl5ORo9erVsixL06ZNU1lZmVwul2pqalRdXa34+HgtW7ZM+fn5g/6zIu2d8twQF4W9+M8M17kA4HJRCUFjY6P+/Oc/a9euXbp06ZJeffVVlZeXq7i4WLm5uSotLVVdXZ2ysrJUVVWl2tpaRSIR+Xw+zZw5U263e1B/nueGON2+Yns0duU/0rRpsdMjAMA1RSUEv/vd75Senq7ly5crFApp5cqVqqmpUU5OjiQpLy9PDQ0NcrlcmjFjhtxut9xut1JSUtTS0qLMzMw+7zsSiVy1ZsZwXnuov/U9AGA4iEoILl68qNOnT2vr1q06deqUli1bJtu2ZVmWJMnr9SoYDCoUCikxMbH797xer0KhUL/3PdIWnRtJswK4fvX3pDQqIRg3bpzS0tLkdruVlpYmj8ejf/3rX93Xh8NhJSUlKSEhQeFwuMf2y8MAAIi+qLxr6Pbbb9d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YAuDZCAPThb3/7mw4cOKBdu3bJsqzuT93u3bu339975plnVFFRoSlTpqi9vV1FRUX68pe/rOnTp8docmBwODUE9CE5OVmnT5/W7t27dfbsWWVkZGj37t3y+/3dSwXv379fixcvVmFhoY4dOyZJmjhxonbu3Kl33nlHLpdLu3bt0vTp07Vnzx4tX75cS5Ys0b333qt9+/Y5uXtAN0IA9CE5OVkvvvii/vSnP2nBggWaO3du95LTn7nlllu0fft2PffccyorK5MkbdiwQTfddJPWr1+vr3zlK6qoqFBbW5sk6eOPP9ZPf/pTvfrqq9q4caM6Ojpivl/AlTg1BPTh5MmTSkhIUHl5uSTpL3/5i77zne/0WGb6jjvukCRNmzZN586dUyQSUXNzs5YvX67ly5fr4sWLWrt2rd544w15vV7dcccdcrlcGj9+vJKSkvThhx+OyKWfcX3hiADow/Hjx7V+/frulSBTU1OVmJjYY0G5z04HHT9+XBMnTpRlWVqxYoVOnDghSbrxxht1yy23yO12S5Kam5slfbLQXigU0k033RTLXQJ6xREB0Ic5c+aotbVV8+fP15gxY2TbtlauXKmf/exn3bc5deqUFi9erLa2Nj3zzDNyu93avHmzSktL1dnZKcuy9KUvfUnf+ta3tHfvXp0/f15LlixRMBhUWVnZiFqlFNcvFp0DYmTPnj36+9//rieffNLpUYAeODUEAIbjiAAADMcRAQAYjhAAgOEIAQAYjhAAgOEIAQAY7v8AFWf8Daj3Rl4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.countplot(x='SibSp',data=train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f321400>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAD5CAYAAAD2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/27EaGhrSt99+q8rKSm3evFnnzp0zPru0KOTH3bITD6uoqHjoNqa2bcvl+s+t43w+nyKRiKLRaOISz3+3R6PRJz5X0/h8PmVnZysajWrHjh2qqakhv3Fwu92qq6tTc3OzKioqyG6MPv/8cz3zzDOJEw6Jf7djlZWVpa1bt+qTTz7R22+/rZ07dxqfXVoUcnZ2tmKxWOLxgwcPuH/2GGRk/O+PPxaLKTc395EsY7HYQ39Zp7Nr165p8+bNevXVV7V27VryG6e2tjZ98cUXamxslGVZie1k93hdXV06c+aMQqGQwuGw6urqdPv27cTzZPd48+bN0y9+8Qu5XC7NmzdPs2bN0q1btxLPm5hdWhTyCy+8kLhn9lhu2Yn/WLRokfr6+iRJvb29Ki4ult/vV39/vyzLUiQS0fDwMHlKunnzpiorK7Vr1y6tX79eEvmN1YkTJ/Thhx9KkmbOnCmXy6UlS5aQ3Rh8+umnOnbsmNrb21VYWKi2tjaVl5eT3RgcP35c77zzjiTp+vXrikajKisrMzq7tLhTF7fsHLvLly/rN7/5jTo7O3Xx4kU1Njbq7t27ys/PV0tLizIzM9XZ2anPPvtMtm1r27ZtqqiomOxpT7qWlhb96U9/Un5+fmLbW2+9pZaWFvJL4t///rf27Nmjmzdv6t69e3rzzTc1f/58/u6NUygU0r59+5SRkUF2YzAyMqI9e/bo6tWrcrlc2rlzp55++mmjs0uLQgYAYKpLi0vWAABMdRQyAAAGoJABADAAhQwAgAEoZAAADEAhAwBgAAoZAAADUMgAABjg/wDAFlyrgNd96AAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "train['Fare'].hist(color='green',bins=40,figsize=(8,4))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Data Cleaning\n",
    "We want to fill in missing age data instead of just dropping the missing age data rows. One way to do this is by filling in the mean age of all the passengers (imputation).\n",
    "However we can be smarter about this and check the average age by passenger class. For example:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f392970>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAssAAAGnCAYAAABB1hpnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3dfZBeZWE28OvZfCzsSkASkFpGTTDYUFsYmwl+kamWsMTECfqmImSWsqAdZDt2W6UBShIpamRCA5omgs64tgnUWqSRSUwhzTCmQk21lbyarrJq1IHIRz6AJEs3G/Z5/3DIWyongWSfPcnZ3+8vzj67z31tnj0P19573+fU6vV6PQAAwK9pKjsAAAAcrZRlAAAooCwDAEABZRkAAAooywAAUGB02QGKPPzww2lubi47BgAAFdff359zzjnnJR87astyc3NzpkyZUnYMAAAqrqenp/AxyzAAAKCAsgwAAAWUZQAAKKAsAwBAAWUZAAAKKMsAAFBAWQYAgALKMgAAFFCWAQCggLIMAAAFlGUAACigLAMAQAFlGQAACoxuxJMODAzk2muvzWOPPZampqbcdNNNGT16dK699trUarVMnjw5ixYtSlOTrg4AwNGrIWX5m9/8Zvbv35+vfOUrefDBB3PbbbdlYGAgXV1dOffcc7Nw4cJs2LAhM2bMaMTwAAAwJBpSlidOnJjnn38+g4OD2bNnT0aPHp2HH34406ZNS5JMnz49Dz74oLL8Mqxbty5r1qwpO8YrsnPnziTJySefXHKSV2b27NmZOXNm2TEAgKNIQ8pyS0tLHnvsscycOTO7du3K7bffnu985zup1WpJktbW1uzevfugz9Hf35+enp5GxDumbNu2LX19fWXHeEWefPLJJMlxxx1XcpJXZtu2bX7mAIAXaUhZ/vKX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IgwIm9Ksm/Ua/PUiVeVHQMO2ynP3F52BAAYEdwVBAAACijLAABQQFkGAIACyjIAABRQlgEAoICyDAAABZRlAAAooCwDAEABZRkAAAooywAAUEBZBgCAAsoyAAAUUJYBAKCAsgwAAAWUZQAAKKAsAwBAAWUZAAAKKMsAAFBAWQYAgALKMgAAFFCWAQCggLIMAAAFlGUAACigLAMAQAFlGQAACijLAABQQFkGAIACyjIAABRQlgEAoMDLKss/+9nP8s1vfjOPP/546vV6ozMBAMBRYfShPmHVqlVZv359nnnmmVx00UX5xS9+kYULFw5HNgAAKNUhZ5bXrl2bL3/5yznhhBNy+eWXZ/PmzcORCwAASnfIsvzCsotarZYkGTt2bGMTAQDAUeKQyzBmzZqVefPmZdu2bfnwhz+c888/fzhyAQBA6Q5Zltvb2/P2t789jzzySCZNmpQ3velNw5ELAABKd8iyfN111x34740bN2bMmDE57bTTMm/evJx44omFX7djx468//3vz5e+9KWMHj061157bWq1WiZPnpxFixalqclV6wAAOLodsrH29/fn1FNPzXve85785m/+Zp544ons27cv8+fPL/yagYGBLFy4MMcdd1ySZPHixenq6spdd92Ver2eDRs2DN13AAAADXLImeWdO3dm6dKlSZLzzjsvV1xxRbq6ujJv3rzCr7n55pvzwQ9+MF/4wheSJFu2bMm0adOSJNOnT8+DDz6YGTNmHHTc/v7+9PT0vOxv5OXq6+sb8ueEMvT19TXkHOHY9cL7m58LGF7OvWo7ZFnes2dPfvKTn+SMM87IT37yk/T19WXXrl2FpfOee+7JySefnPPOO+9AWa7X6weuptHa2prdu3cfMlhzc3OmTJnySr6Xl6WlpSXJM0P+vDDcWlpaGnKOcOz61ftb/FzAMHPuHfsO9ovOIcvywoULc8011+TJJ5/Mcccdl/e97335xje+kauuuuolP/9rX/taarVa/u3f/i09PT2ZP39+du7ceeDxvXv3Zty4cYfxbQAAwPA65Jrl3/3d380nPvGJvP3tb89zzz2XHTt2ZN68eWlra3vJz7/zzjuzatWqrFy5MlOmTMnNN9+c6dOnZ9OmTUl+tU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QYAgALKMgAAFFCWAQCggLIMAAAFlGUAACigLAMAQAFlGQAACijLAABQQFkGAIACyjIAABRQlgEAoICyDAAABZRlAAAooCwDAEABZRkAAAooywAAUEBZBgCAAsoyAAAUUJYBAKDA6LIDAByt1q1blzVr1pQd42Xr7e1NknR2dpac5JWZPXt2Zs6cWXYMgJdkZhmgIo4//vjs2bMnzz77bNlRACrDzDJAgZkzZx5TM55tbW1JkieffDIrV64sOQ1ANZhZBqiAf//3f8/u3buTJLt37853v/vdkhMBVIOyDFABCxYseNHxX/7lX5aUBKBalGWACnhhVrnoGIDDoywDVMAJJ5xw0GMADo+yDFABN91004uOP/WpT5WUBKBalGWACjjppJMOegzA4VGWASrgxhtvfNHxokWLSkoCUC3KMkAFbN269aDHABweZRmgAiZOnHjQYwAOj7IMUAGXX375i46vvPLKcoIAVIzbXR/l1q1blzVr1pQd4xXp7e1NknR2dpac5JWZPXv2MXVrY/ifVqxY8aLjv/mbv8m73/3uktIAVIeyzJAbP3582RFgxHniiSdedPz444+XlASgWpTlo9zMmTPNdgIAlGTYyvLg4GA+8YlP5Ec/+lHGjh2bT37yk3n9618/XMMDVFpLS0v6+voOHLe2tpaYBo7MsbYE0fLDahu2DX7/8i//kn379uUf/uEf8rGPfSyf+cxnhmtogMr79Kc//aLjxYsXl5QERp7x48dbglhhwzaz/B//8R8577zzkiTnnHNOfvCDHxz08/v7+9PT0zMc0QCOeSeccEKam5vT39+f5ubmtLa2eg/lmPWGN7whf/Inf1J2jBHB+8ShDVtZ3rNnT171qlcdOB41alT279+f0aNfOkJzc3OmTJkyXPEAjnk333xz/vzP/zxLlizx/gnwChzsl4ZhK8uvetWrsnfv3gPHg4ODhUUZgFdu2rRp+da3vlV2DIBKGbY1y295y1uycePGJMnDDz+cM888c7iGBgCAwzJsU7szZszIgw8+mA9+8IOp1+u/thkFAACONsNWlpuamvJXf/VXwzUcAAAcsWFbhgEAAMcaZRkAAAooywAAUEBZBgCAAsoyAAAUUJYBAKCAsgwAAAWUZQAAKKAsAwBAAWUZAAAKDNvtrl+p/v7+9PT0lB0DAICK6+/vL3ysVq/X68OYBQAAjhmWYQAAQAFlGQAACijLAABQQFkGAIACyjIAABRQlgEAoICyzJDbvHlz2tvby44BI8rAwECuueaaXHrppZk7d242bNhQdiQYEZ5//vlcd911+eAHP5h58+blF7/4RdmRGGJH7Sm/l4sAAAPuSURBVE1JODZ98YtfzL333pvjjz++7Cgwotx777056aSTsmTJkuzatSvve9/78gd/8Adlx4LKe+CBB5IkX/nKV7Jp06YsXrw4n//850tOxVAys8yQet3rXpdly5aVHQNGnAsvvDB/+qd/euB41KhRJaaBkeP888/PTTfdlCTZtm1bJkyYUHIihpqZZYZUW1tbHn300bJjwIjT2tqaJNmzZ08++tGPpqurq+REMHKMHj068+fPz/r16/O5z32u7DgMMTPLABXxy1/+MpdddlnmzJmT9773vWXHgRHl5ptvzn333ZcFCxakr6+v7DgMIWUZoAK2b9+eK664Itdcc03mzp1bdhwYMVavXp077rgjSXL88cenVqtZBlUxyjJABdx+++159tlns2LFirS3t6e9vT3//d//XXYsqLwLLrgg//Vf/5V58+blyiuvzPXXX5/m5uayYzGEavV6vV52CAAAOBqZWQYAgALKMgAAFFCWAQCggLIMAAAFlGUAACigLAMchTZt2pS3ve1tBy4D94EPfCArV658yc9tb2/PT37yk2FOCDAyuN01wFHqrW99a2699dYkyb59+3LhhRdmzpw5GTduXMnJAEYOZRngGLBnz540NTXlhz/8YW655ZbU6/W85jWvyS233HLgcx5//PF84hOfSH9/f55++ul0dnbm/PPPz6233ppvf/vbGRwczKxZs3L55ZfnzjvvzOrVq9PU1JS3vOUtmT9/fonfHcDRS1kGOEp9+9vfTnt7e2q1WsaMGZMFCxbkk5/8ZG699dacccYZufPOO1+0/OKnP/1pOjo6cu655+Y///M/s2zZspx//vlZvXp1Vq1alde85jW55557kiT33HNPFixYkHPOOSd33XVX9u/fn9Gj/S8B4H/zzghwlPqfyzBecP311+eMM85IksybN+9Fj51yyin5/Oc/n7vvvju1Wi379+9PkixdujRLly7N9u3bc9555yVJFi9enC996Uu55ZZbcs4558TNXAFemg1+AMeQU089NT/72c+SJF/4wheyfv36A4999rOfzZw5c7JkyZKce+65qdfr2bdvX/75n/85S5cuzd/+7d/mn/7pn/LYY4/lq1/9am688casWrUqPT09+d73vlfSdwRwdDOzDHAMufHGG3P99denqakpp5xySi6//PL83d/9XZLkwgsvzKc+9anccccd+Y3f+I3s2rUrY8eOzYknnpg5c+bkxBNPzDve8Y689rWvzZve9KbMnTs3r371q/Oa17wmZ599dsnfGcDRqVb3tzcAAHhJlmEAAEABZRkAAAooywAAUEBZBgCAAsoyAAAUUJYBAKCAsgwAAAX+Hx7uxnjnv1OCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 864x504 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(12, 7))\n",
    "sns.boxplot(x='Pclass',y='Age',data=train,palette='winter')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see the wealthier passengers in the higher classes tend to be older, which makes sense. We'll use these average age values to impute based on Pclass for Age."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def impute_age(cols):\n",
    "    Age = cols[0]\n",
    "    Pclass = cols[1]\n",
    "    \n",
    "    if pd.isnull(Age):\n",
    "\n",
    "        if Pclass == 1:\n",
    "            return 37\n",
    "\n",
    "        elif Pclass == 2:\n",
    "            return 29\n",
    "\n",
    "        else:\n",
    "            return 24\n",
    "\n",
    "    else:\n",
    "        return Age"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now apply that function!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "train['Age'] = train[['Age','Pclass']].apply(impute_age,axis=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now let's check that heat map again!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x19e8f632d60>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAV0AAAEnCAYAAAAKMZAQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAdeUlEQVR4nO3de1SWVd7/8c+tiDgeIWPMIjU1S0d/eR7q0YqmmjEzPAVomAVqQ1mImoGGaCUWWuosm0bLA3lgYpZ2EMNGZ6U5Tanp5KEoQQ1NBdRUDgoF1+8P130/eOr5/R6vvWPw/VqrteC+17q+pPK597X3d+/L4ziOIwCAFXV+6R8AAK4mhC4AWEToAoBFhC4AWEToAoBFhC4AWOT3c2/eW2eorZ8DwFVk3eEvrda7v+X/sVrv71WZl32PkS4AWEToAoBFhC4AWEToAoBFhC4AWEToAoBFhC4AWEToAoBFhC4AWEToAoBFhC4AWEToAoBFhC4AWPSzp4wBgAm2T/2yfarZzyF0AVhX+492vPx7TC8AgEWELgBYROgCgEWELgBYROgCgEWELgBYROgCgEWELgBYxOYIANbZ3qxQkxC6AKyr7TvSfg6hC8C6mhSCthG6AKxjpAsAFtWkELSN0AVg3dU80qVlDAAsInQBwCJCFwAsYk4XgHU1aY7VNkIXgHUspAEArGCkC8C6mjTytI3QBWAd0wsAACsIXQCwiNAFAIsIXQCwiNAFAIsIXQCwiNAFAIsIXQCwiNAFAIsIXQCwiNAFAIsIXQCwiANvAFhXkw6gsY3QBWAdp4wBAKwgdAHAIkIXACwidAHAIkIXACwidAHAIkIXACyiTxeAdTWpb9Y2QheAdWyOAABYQegCgEVMLwCwribd7ttG6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LtaGDRtUWFioli1b6q677jK+scXrhx9+UL169Vyv59pINyQkxHdIiw02DhS5kOnbRYlgNcHm5g+bf3+1PXClc0/mDQ8Pt1pz48aNmj59upo0aaKysjJNnz5dvXv3du36ro104+PjVVJSoltvvdU352JyMv9S/YIm2lluv/12hYaGynEcffbZZ755QYnbfaA2Gjp0qP7yl78oKChIRUVFevLJJ10998S1ka7pHVoXutQjtU08zmbOnDm+r00/VwvAL69hw4a+p/9ee+21atCggavXdy10H3zwQa1evVpHjhxR79691b59e7cufUneg4wdx9FXX31l7BlU3O4DVwdv+11lZaXGjBmj7t27a+fOna6vTbkWulOnTjX62OILXTjqtNHJAKD28rbfVW/DM7Gb0LXQNf3Y4gtVP8CksLBQR44cMVoPQO3mbb8rLi7Wli1bzmt/dZNroWv6scUXSk5O9h1g0qxZs6tiJReAeY8//rjatWunxo0bSzq3e9HNvm7XQvfCxxYnJSW5denzeJ9eW/0Ak7Nnzxrfcgng6tC4cWOlpqYau75rLWNeJ06cUJMmTeTn51qenyc2NlYTJkzQLbfcon79+iktLc339FrTfboAar9FixapQYMG5z1pvGfPnq5d37Vk/PDDD1VVVaWKigqlpaUpJiZGMTExbl3e53IHmNg6VxdA7bZt2zZVVFRo69atks5NL9TI0F20aJEWLFighIQEffzxx3r88ceNhO7lDjApLS11vRaAq09ZWZmWLFli7PquhW79+vUlnWss9j7PyIRf4um1AK4e7du315o1a9SxY0ff7lo3T3NzbU73ueee05YtW/T8889rz549KioqMvbUTpsHmAC4ungf7eSNxoqKCt9Tpd3g6kJaaWmpGjZsqGPHjvl2jAHAf4L4+Hjftv+33nrLNz0aHR3te0CtG1xbfdq6dau++OILbdy4UZGRkfrggw/cujQAGHf8+HHf1xs3bvR97fah6a6Fblpamlq3bq309HStXLmS9i0A/7FMHuPqWujWr19f11xzjfz8/HTttdeqoqLCrUsDgHHVR7QmHwnkWvdCo0aN9Nhjj2nYsGFavnz5eU+QAICa7lKPWnIcR3l5ea7WcW0hraKiQvn5+WrXrp2+/fZbtW7d2ujjegDATbYeteRa6H733XfKzs72nYFQWFho/DHlAPCfxrU5Xe8pX9u3b9ehQ4d08uRJty4NALWGa6EbEBCgMWPG6Ne//rVmzpypY8eOuXVpAKg1XAtdx3FUVFSksrIylZWV6dSpU25dGgBqDVdCt6SkRE899ZTWr1+vAQMG6J577lHfvn3duDQA1CpXvJC2bNkyLVq0SH5+fpoyZQphCwA/44pHumvWrFF2drYyMjKUnp7uxs8EALXWFYeuv7+//P39FRQUxCNzAOB/4OrjFkzuVwaA2uCK53Rvv/12hYaGynEcffbZZ76nOUjS7Nmzr/gHBIDa5IpD19bWOQCoDVx/GjAA4PJ4hC4AWEToAoBFhC4AWEToAoBFhC4AWPR/AZOBJDOBggrCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(train.isnull(),yticklabels=False,cbar=False,cmap='viridis')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Great! Let's go ahead and drop the Cabin column and the row in Embarked that is NaN."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "train.drop('Cabin',axis=1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "\n",
       "                                                Name     Sex   Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male  22.0      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                             Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "4                           Allen, Mr. William Henry    male  35.0      0   \n",
       "\n",
       "   Parch            Ticket     Fare Embarked  \n",
       "0      0         A/5 21171   7.2500        S  \n",
       "1      0          PC 17599  71.2833        C  \n",
       "2      0  STON/O2. 3101282   7.9250        S  \n",
       "3      0            113803  53.1000        S  \n",
       "4      0            373450   8.0500        S  "
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "train.dropna(inplace=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Converting Categorical Features \n",
    "\n",
    "We'll need to convert categorical features to dummy variables using pandas! Otherwise our machine learning algorithm won't be able to directly take in those features as inputs."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 889 entries, 0 to 890\n",
      "Data columns (total 11 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   PassengerId  889 non-null    int64  \n",
      " 1   Survived     889 non-null    int64  \n",
      " 2   Pclass       889 non-null    int64  \n",
      " 3   Name         889 non-null    object \n",
      " 4   Sex          889 non-null    object \n",
      " 5   Age          889 non-null    float64\n",
      " 6   SibSp        889 non-null    int64  \n",
      " 7   Parch        889 non-null    int64  \n",
      " 8   Ticket       889 non-null    object \n",
      " 9   Fare         889 non-null    float64\n",
      " 10  Embarked     889 non-null    object \n",
      "dtypes: float64(2), int64(5), object(4)\n",
      "memory usage: 83.3+ KB\n"
     ]
    }
   ],
   "source": [
    "train.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "sex = pd.get_dummies(train['Sex'],drop_first=True)\n",
    "embark = pd.get_dummies(train['Embarked'],drop_first=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "train.drop(['Sex','Embarked','Name','Ticket'],axis=1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "train = pd.concat([train,sex,embark],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>male</th>\n",
       "      <th>Q</th>\n",
       "      <th>S</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass   Age  SibSp  Parch     Fare  male  Q  S\n",
       "0            1         0       3  22.0      1      0   7.2500     1  0  1\n",
       "1            2         1       1  38.0      1      0  71.2833     0  0  0\n",
       "2            3         1       3  26.0      0      0   7.9250     0  0  1\n",
       "3            4         1       1  35.0      1      0  53.1000     0  0  1\n",
       "4            5         0       3  35.0      0      0   8.0500     1  0  1"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Great! Our data is ready for our model!\n",
    "\n",
    "# Building a Logistic Regression model\n",
    "\n",
    "Let's start by splitting our data into a training set and test set.\n",
    "\n",
    "## Train Test Split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(train.drop('Survived',axis=1), \n",
    "                                                    train['Survived'], test_size=0.30, \n",
    "                                                    random_state=101)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Training and Predicting"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LogisticRegression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Akash\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:762: ConvergenceWarning: lbfgs failed to converge (status=1):\n",
      "STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n",
      "\n",
      "Increase the number of iterations (max_iter) or scale the data as shown in:\n",
      "    https://scikit-learn.org/stable/modules/preprocessing.html\n",
      "Please also refer to the documentation for alternative solver options:\n",
      "    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n",
      "  n_iter_i = _check_optimize_result(\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LogisticRegression()"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logmodel = LogisticRegression()\n",
    "logmodel.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "predictions = logmodel.predict(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's move on to evaluate our model!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Evaluation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can check precision,recall,f1-score using classification report!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import classification_report"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0       0.79      0.92      0.85       163\n",
      "           1       0.83      0.62      0.71       104\n",
      "\n",
      "    accuracy                           0.81       267\n",
      "   macro avg       0.81      0.77      0.78       267\n",
      "weighted avg       0.81      0.81      0.80       267\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(classification_report(y_test,predictions))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Not so bad! You might want to explore other feature engineering and the other titanic_text.csv file, some suggestions for feature engineering:\n",
    "\n",
    "* Try grabbing the Title (Dr.,Mr.,Mrs,etc..) from the name as a feature\n",
    "* Maybe the Cabin letter could be a feature\n",
    "* Is there any info you can get from the ticket?\n",
    "\n",
    "## Thank You!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
